using System;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;

namespace OrderingSystem.Core.Entities
{
    [Table("storeup")]
    public class Favorite
    {
        [Column("id")]
        public long id { get; set; }

        /// <summary>
        /// 添加时间
        /// </summary>
        [Column("addtime")]
        public DateTime addtime { get; set; }

        /// <summary>
        /// 名称
        /// </summary>
        [Column("name")]
        public string mingcheng { get; set; }

        /// <summary>
        /// 图片
        /// </summary>
        [Column("picture")]
        public string tupian { get; set; }

        /// <summary>
        /// 类型
        /// </summary>
        [Column("tablename")]
        public string leixing { get; set; }

        /// <summary>
        /// 价格
        /// </summary>
        [NotMapped]
        public decimal jiage { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        [NotMapped]
        public string yonghuming { get; set; }

        /// <summary>
        /// 用户ID
        /// </summary>
        [Column("userid")]
        public long userid { get; set; }

        /// <summary>
        /// 收藏编号
        /// </summary>
        [Column("refid")]
        public long refid { get; set; }

        // 为了兼容性保留的旧属性名称
        [JsonIgnore]
        [NotMapped]
        public long Id { get => id; set => id = value; }

        [JsonIgnore]
        [NotMapped]
        public DateTime AddTime { get => addtime; set => addtime = value; }

        [JsonIgnore]
        [NotMapped]
        public string MingCheng { get => mingcheng; set => mingcheng = value; }

        [JsonIgnore]
        [NotMapped]
        public string TuPian { get => tupian; set => tupian = value; }

        [JsonIgnore]
        [NotMapped]
        public string LeiXing { get => leixing; set => leixing = value; }

        [JsonIgnore]
        [NotMapped]
        public decimal JiaGe { get => jiage; set => jiage = value; }

        [JsonIgnore]
        [NotMapped]
        public string YongHuMing { get => yonghuming; set => yonghuming = value; }

        [JsonIgnore]
        [NotMapped]
        public long UserId { get => userid; set => userid = value; }

        [JsonIgnore]
        [NotMapped]
        public long RefId { get => refid; set => refid = value; }

        [ForeignKey("userid")]
        public User User { get; set; }
    }
} 